/*
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 *
 * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
 *
 * Contributor(s): 
 *  Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
 *  
 * If you didn't download this code from the following link, you should check
 * if you aren't using an obsolete version: http://www.isqlviewer.com
 */
package org.isqlviewer.event;

import java.util.EventObject;

/**
 * Event for describing a progression.
 * <p>
 * This object is mainly designed to complement JProgressBars. this method supports most of the values to properly
 * describe a state of progress to a JProgressBar.
 * <p>
 * This class is also setup to be mutable so that ProgressEvent do not always have to be instantiated.
 * 
 * @author Mark A. Kobold &lt;mkobold at isqlviewer dot com&gt;
 * @version 1.0
 */
public class ProgressEvent extends EventObject {

    private static final long serialVersionUID = -2854383461733335079L;
    private int progress = 0;
    private int maximum = 0;
    private String note = "";

    /**
     * Default constructor.
     * <p>
     * Creates the event with the given source, specified progress and maximum values.
     * 
     * @see #setMaximum(int)
     * @see #setProgress(int)
     * @param source of which the event comes from.
     * @param progress the current progress.
     * @param maximum the maximum value as it relates to the progress.
     */
    public ProgressEvent(Object source, int progress, int maximum) {

        super(source);
        setMaximum(maximum);
        setProgress(progress);
    }

    /**
     * @return the maximum value for this event.
     */
    public int getMaximum() {

        return maximum;
    }

    /**
     * @return the current progress for this event, -1 for indeterminate.
     */
    public int getProgress() {

        return progress;
    }

    /**
     * @param progress indicator for this event.
     */
    public void setProgress(int progress) {

        this.progress = progress;
    }

    /**
     * @return String that shows extra information regarding this event.
     */
    public String getNote() {

        return note;
    }

    /**
     * @param note extra information regarding this event.
     */
    public void setNote(String note) {

        this.note = note;
    }

    /**
     * @param maximum value of the total progress.
     */
    protected void setMaximum(int maximum) {

        this.maximum = maximum;
    }

}
